use CAFEDB
go
-----------------------------DELETE PROCEDURE------------------------------
--AREA
CREATE PROC DELTELEAREABYAREAID(@AREAID VARCHAR(20))
AS
	BEGIN
		DELETE FROM AREA
		WHERE AREA.AREAID=@AREAID
	END
GO
--DEPARTMENT
CREATE PROC DELTELEDEPARTMENTBYDEPARTMENTID(@DEPARTMENTID VARCHAR(20))
AS
	BEGIN
	DELETE FROM DEPARTMENT WHERE DEPARTMENTID=@DEPARTMENTID
	END
GO
--DETAIL_GROUPUSER_ROLE
CREATE  PROC DELTELEDETAIL_GROUPUSER_ROLE(@GROUPUSERCODE INT)
AS
	BEGIN
	DELETE FROM DETAIL_GROUPUSER_ROLE WHERE DETAIL_GROUPUSER_ROLE.GROUPUSERCODE=@GROUPUSERCODE
	
	END
GO
--EMPLOYER
CREATE PROC DELTELEEMPLOYERBYEMPLOYERID(@EMPLOYERID int)
AS
	BEGIN
		DELETE FROM EMPLOYER WHERE EMPLOYER.EMPLOYERID=@EMPLOYERID
	END
GO
--EXPORT

--EXPORTDETAIL

--GROUPUSER
CREATE PROC DELTELEGROUPUSERBYGROUPUSERID(@GROUPUSERCODE INT)
AS
	BEGIN
		DELETE FROM GROUPUSER WHERE GROUPUSER.GROUPUSERCODE=@GROUPUSERCODE
	END
GO
--IMPORT

--IMPORTDETAIL

--ITEM
CREATE  PROC DELTELEITEMBYITEMID(@ITEM INT)
AS
	BEGIN	
		DELETE FROM ITEM WHERE ITEM.ITEMID=@ITEM
	END
GO
--ITEMTYPE
CREATE PROC DELTELEITEMTYPEBYITEMTYPEID(@ITEMTYPE INT)
AS
	BEGIN
		DELETE FROM ITEMTYPE WHERE ITEMTYPE.ITEMTYPEID=@ITEMTYPE
	END
GO
--MATERIAL
CREATE PROC DELTELEMATERIALBYMATERIALID(@MATERIALID INT)
AS
	BEGIN
		 DELETE FROM MATERIAL WHERE MATERIAL.MATERIALID=@MATERIALID
	END
GO
--ROLE
CREATE PROC DELTELEGROUPROLEBYGROUPROLEID(@GROUPROLECODE varchar(50))
AS
	BEGIN
		DELETE FROM [GROUPROLE] WHERE GROUPROLE.GROUPROLECODE=@GROUPROLECODE 
	END
GO
--ROLE
CREATE PROC DELTELEROLEBYROLEID(@ROLECODE VARCHAR(50))
AS
	BEGIN
		DELETE FROM [ROLE] WHERE ROLE.ROLECODE=@ROLECODE 
	END
GO
--TABLE
CREATE PROC DELTELETABLEBYTABLEID(@TABLEID VARCHAR(20))
AS
	BEGIN
		DELETE FROM [TABLE] WHERE [TABLE].TABLEID =@TABLEID
	END
GO
--UNIT
CREATE PROC DELTELEUNITBYUNITID(@UNITID INT)
AS
	BEGIN
		DELETE FROM UNIT WHERE UNIT.UNITID=@UNITID
	END
GO
--USERACCOUNT
CREATE PROC DELTELEBYUSERACCOUNTBYUSERACCOUNT(@USERNAME VARCHAR(30))
AS
	BEGIN
		DELETE FROM USERACCOUNT WHERE USERACCOUNT.USERNAME=@USERNAME
	END
GO
--WAGE
CREATE PROC DELTELEWAREBYWAGEID (@WAGEID VARCHAR(20))
AS
	BEGIN
		DELETE FROM WAGE WHERE WAGE.WAGEID =@WAGEID
	END